﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Admin_Country : System.Web.UI.Page
{
    CountryBusiness cb = new CountryBusiness();
    protected void Page_Load(object sender, EventArgs e)
    {
        bindGV();
    }

    public void bindGV()
    {
        GridView1.DataSource = cb.getAllCountry();
        GridView1.DataBind();
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Response.Redirect("CountryEdit.aspx?countryID="+0);
    }
    protected void lbEdit_Click(object sender, EventArgs e)
    {
        Response.Redirect("CountryEdit.aspx?countryID=" + ((LinkButton)sender).CommandArgument);
    }
    protected void lbDelete_Click(object sender, EventArgs e)
    {
        if (!cb.Delete(int.Parse(((LinkButton)sender).CommandArgument)))
            Label1.Text = "Can't delete";
        Response.Redirect("Country.aspx");
    }

}